<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false&amp;language=<?php echo $this->userLanguage ?>"></script>
<script type="text/javascript">
window.addEvent("load", function(){
  $$('li.tab_layout_gmapsprofile_place_profile').addEvent('click', function(){
      if (!is_load)  {
	    initialize();
		is_load=true;
	  }	
  });
});
</script>
<ul>
  <li>
	<div id="map_canvas"></div>
  </li>
</ul>
<?php
	$user = $this->user;
	$point = ', ';
	if (empty($this->gender) || empty($this->birthdate)) $point="";	
	  $gender_bd = $this->translate(strtolower($this->gender)).$point.$this->birthdate;	

	if( $this->online != 0 )
	  $online = "<div class=online_user_small>".$this->translate('Online')."</div>";
	else 
	  $online = "<div class=offline_user_small>".$this->translate('Offline')."</div>";   
	
	$compose = '';
	$friend = '';
	$block = '';
	$report = '';
	if( $this->viewer()->getIdentity() )
      $compose = $this->gmapsprofileCompose($user);
    if( $this->viewer()->getIdentity() )
      $friend = $this->gmapsprofileFriendship($user);
    if( $this->viewer()->getIdentity() )
	  $block = $this->gmapsprofileBlock($user);
 	if( $this->viewer()->getIdentity() )
      $report = $this->gmapsprofileReport($user);	
	
	$content_info = '<table width=200px border=0 cellpadding=3><tr><td width=55px><div class=icon_small_user>'.$this->htmlLink($user->getHref(), $this->itemPhoto($user, "thumb.icon")).$online.'</div></td><td valign=top style=padding-left:5px;><span class=displayname_user>'.$this->htmlLink($user->getHref(), $user->getTitle()).'</span><br /><span class=gender_user>'.$gender_bd.'</span><br /><span class=location_user>'.$this->location.'</span><br /><div class=link_members_gmap>'.$compose.$friend.$block.$report.'</div></td></tr></table>';
?>
<script type="text/javascript">
var is_load=false;
function initialize() {
	   $('map_canvas').set('style', 'width:'+$('map_canvas').offsetWidth+'px');
	   $('map_canvas').set('style', 'height:'+$('map_canvas').offsetWidth+'px');
	   geocoder = new google.maps.Geocoder();
       var latlng = new google.maps.LatLng(40.7406578, -74.0020894);
       var myOptions = {
               zoom: <?php echo $this->scale ?>,
               center: latlng,
			   disableDefaultUI: false,
               mapTypeId: google.maps.MapTypeId.<?php echo $this->map_type ?>
       };
       map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
	   
var contentString = '<?php echo $content_info ?>';
  var infowindow = new google.maps.InfoWindow({
    content: contentString,
	disableAutoPan: false,
  });

    var address_user = '<?php echo $this->location ?>';

    geocoder.geocode( { 'address': address_user}, function(results, status) {
      if (status == google.maps.GeocoderStatus.OK) {
        map.setCenter(results[0].geometry.location);
		var marker = new google.maps.Marker({
		    position: results[0].geometry.location,
		    map: map,
		});
	    google.maps.event.addListener(marker, 'click', function() {
	  	    infowindow.open(map,marker);
	    });			
      }
    });

	  
}

window.addEvent('load', function() {
     initialize();
});

</script>
